package cn.wmw.xyy.fallback;

import cn.wmw.result.JsonResult;
import cn.wmw.xyy.exception.GlobalExceptionEnum;
import cn.wmw.xyy.feign.UserCodeFeignClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserCodeFeignClientFallbackFactory implements FallbackFactory<UserCodeFeignClient> {


    @Override
    public UserCodeFeignClient create(Throwable throwable) {
        return new UserCodeFeignClient() {
            @Override
            public JsonResult linkCode(String linkCode) {
                return JsonResult.error(GlobalExceptionEnum.ERROR.getMessage());
            }
        };
    }
}

